package com.aaa.qy127.controller;

import com.aaa.qy127.entity.Dept;
import com.aaa.qy127.service.DeptService;
import com.aaa.qy127.util.Result;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;


@RequestMapping("/dept")
@RestController
public class DeptController {

    @Resource(name = "deptServiceImpl")
    private DeptService deptService;

    /**
     * 查询 全部的 dept 的业务的 转发
     * @return
     */
    @RequestMapping("/selectDept")
    public  List<Map<String, Object>> selectDept(){
        List<Map<String, Object>> maps = deptService.selDept();
        return maps;
    }

    @RequestMapping("/zx")
    public String addDept(Dept dept){
        String s = deptService.addDept(dept);
        return s;
    }

    /**
     * 查询信息
     * @param dept
     * @return
     */
    @RequestMapping("/list")
    public Result queryAllBook(Dept dept){
        Result result = deptService.queryAllBook(dept);
        return result;
    }

    /**
     * 修改上下架的状态
     * @param deptid
     * @param status
     * @return
     */
    @RequestMapping("/updateStatus")
    public String updateStatus(Integer deptid, Integer status, Integer count){
        String s = deptService.updateStatus(deptid, status, count);
        return s;
    }
    @RequestMapping("/max")
    public int max(){
        int max = deptService.max();
        return max;
    }
}
